﻿using SIR.Common;
using SIR.Common.Condition;
using System.Collections.Generic;

namespace SIR.DAL
{
	/// <summary>
	/// Data Server results containing a list of objects
	/// </summary>
	/// <typeparam name="T">The type of objects contained within the list</typeparam>
	public class DataServerResults<T> where T : IEntity
	{
		/// <summary>
		/// Creates a new results object with a reference to the condition used to reach the results
		/// </summary>
		/// <param name="condition">The condition used to produce the results</param>
		public DataServerResults(IPredicate condition)
		{
			Condition = condition;
			Results = new List<T>();
		}
		/// <summary>
		/// Gets whether or not the results were successfully obtained
		/// </summary>
		public bool WasSuccessful { get; internal set; }
		/// <summary>
		/// Gets the error message that occured during the execution
		/// </summary>
		public string ErrorMessage { get; internal set; }
		/// <summary>
		/// Gets the results produced by the predicate
		/// </summary>
		public IList<T> Results { get; internal set; }
		/// <summary>
		/// Gets condition used to produce the results
		/// </summary>
		public IPredicate Condition { get; internal set; }
	}
}
